package development;

import state.GameForm;
import state.Key;
import state.component.TextField;
import state.util.GameColor;
import state.util.Hashtable;

public class FrmTestTouchTextField extends GameForm {
  private static GameForm singleton = null;

  public static GameForm instance() {
    if (singleton == null) {
      singleton = new FrmTestTouchTextField();
    }
    return singleton;
  }

  private TextField textField = null;

  public void init(Hashtable parameters) {
    _manager.setBackGroundColor(GameColor.BLACK_CODE);
    textField = new TextField(_manager, TextField.CONSTRAINT_ANY, Global.TEXT_FIELD_STYLE);
    textField.setFocused(true).setPosition(50, 50).setSize(150, 20);
    textField.setBackgroundColor(GameColor.BLACK_CODE);
  }

  public void keyReleased(int keyCode) {
    if (keyCode == Key.SOFT_RIGHT) {
      Global.nextState(FrmMenu.instance(), null);
      return;
    }
    textField.keyReleased(null, keyCode);
  }

  public void destroy() {
  }
}
